package com.example.tianyidemo.controller;
import com.example.tianyidemo.pojo.Post;
import com.example.tianyidemo.pojo.Result;
import com.example.tianyidemo.service.PostService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//获取帖子信息（简略）
@Slf4j
@CrossOrigin//准许跨域请求
@RestController//包含@Controller（三层架构声明控制器）和@ResponseBody（转化json格式）
public class PostController {
    @Autowired
    private PostService postService;
    @ResponseBody
    @GetMapping("/getpost")
    public Result postListlist(){
        List<Post> postList = postService.getpost();
        return Result.success(postList);
    };



}
